#include <iostream>
#include "common.h"
#include "stack.h"
#include "queue.h"
#include "ulimit_tree.h"
using namespace std;

int main()
{
    try
    {
#if 0
        Stack<int> stackInt;
        stackInt.push(3);
        stackInt.push(5);
        stackInt.push(7);

        while( !stackInt.empty() )
        {
            int value = stackInt.pop();
            cout<<"Pop:"<<value<<endl;
        }

        FixedQueue<int> fqInt;
        for(int i=1;i<QUEUE_SIZE; i++)
        {
            fqInt.enter(i);
        }

        for( int i=0;i<100; i++ )
        {
            int value = fqInt.leave();
            cout<<"Leave1:"<<value<<endl;
        }

        for( int i=0;i<100; i++ )
        {
            fqInt.enter(i+1000);
        }

        while( !fqInt.empty() )
        {
            int value = fqInt.leave();
            cout<<"Final Leave:"<<value<<endl;
        }
#endif
        UlimitLinearTree<int> ulTree;
        int c1 = ulTree.addChild(0,1);
        int c2 = ulTree.addChild(0,5);
        int c11 = ulTree.addChild(c1,2);
        int c12 = ulTree.addChild(c1,3);
        int c13 = ulTree.addChild(c1,4);

        int c21 = ulTree.addChild(c2,6);
        int c22 = ulTree.addChild(c2,7);

        int c211 = ulTree.addChild(c21,8);
        int c212 = ulTree.addChild(c21,9);

        ulTree.traverse();

        ulTree.report();

        return 0;
    }
    catch( Exception &e )
    {
        cerr<<"Error:"<<e.toString()<<endl;
    }
}

